Skip to content

fix(sql): support unsigned ASOF join keys#19603

Merged
sundy-li merged 9 commits intodatabendlabs:mainfrom
sundy-li:issue-19570-20260324-1953
Apr 20, 2026
Merged

fix(sql): support unsigned ASOF join keys#19603
sundy-li merged 9 commits intodatabendlabs:mainfrom
sundy-li:issue-19570-20260324-1953

Conversation

@sundy-li
Copy link
Copy Markdown
Member

@sundy-li sundy-li commented Mar 24, 2026

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

  • extend ASOF join boundary generation to support unsigned integer join keys
  • replace ASOF boundary unwrap() calls with BadDataValueType propagation so unsupported types return an error instead of panicking
  • add an expression-level regression test plus an unsigned ASOF sqllogictest case

Fixes #19570

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Validation:

  • cargo test -p databend-common-expression --test it test_integer_infinity_boundaries
  • cargo clippy -p databend-common-sql --lib --tests -- -D warnings

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that could cause existing functionality not to work as expected)
  • Documentation Update
  • Refactoring
  • Performance Improvement
  • Other (please describe):

This change is Reviewable

@github-actions github-actions Bot added the pr-bugfix this PR patches a bug in codebase label Mar 24, 2026
@sundy-li sundy-li added the agent-reviewable Ready for agent review label Mar 24, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b940b91509

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/query/expression/src/types.rs Outdated
Comment thread src/query/expression/src/types.rs Outdated
Comment thread src/query/expression/src/types.rs Outdated
Copy link
Copy Markdown
Member Author

@sundy-li sundy-li left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a blocking issue in the unsigned ASOF sentinel handling. Using the type-domain max/min as infinity() / ninfinity() makes the rewrite drop valid boundary matches (>= at MAX and <= at MIN). See the inline comment for a concrete example.

Copy link
Copy Markdown
Member Author

@sundy-li sundy-li left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Focused verification passed, but the new unsigned sentinels still make ASOF results wrong at the legal type boundaries. rewrite_asof() uses infinity()/ninfinity() as the LEAD default and then applies strict < / > bounds, so rows at UInt*_MAX or UInt*_MIN cannot match the terminal or initial interval even though they should. This means unsigned ASOF joins are still incorrect for valid key values and need a different unbounded strategy or dedicated operator before this lands.

@sundy-li sundy-li added the agent-changed Changed by agent label Mar 24, 2026
@sundy-li sundy-li added agent-approved Approved by agent and removed agent-changed Changed by agent agent-reviewable Ready for agent review labels Mar 24, 2026
@KKould KKould self-requested a review April 8, 2026 07:00
@KKould
Copy link
Copy Markdown
Member

KKould commented Apr 8, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 48881149de

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@KKould
Copy link
Copy Markdown
Member

KKould commented Apr 8, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@KKould KKould requested review from forsaken628 and zhang2014 April 8, 2026 08:45
@sundy-li sundy-li enabled auto-merge April 14, 2026 06:25
@sundy-li sundy-li added this pull request to the merge queue Apr 20, 2026
Merged via the queue into databendlabs:main with commit 8e5683e Apr 20, 2026
91 checks passed
@sundy-li sundy-li deleted the issue-19570-20260324-1953 branch April 20, 2026 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-approved Approved by agent pr-bugfix this PR patches a bug in codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ASOF Join panics on UInt8 type — unwrap on unsupported type

2 participants